<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>检测详情页</title>
    <link rel="stylesheet" href="css/details.css">
    <script src="js/jquery-1.9.1.min.js"></script>
    <script src="js/timeformat.js"></script>
</head>
<body>
<div id="content"></div>
</body>
<script>
    var url = location.search; //获取url中"?"符后的字串 ('?modFlag=business&role=1')
    var theRequest = new Object();
    if ( url.indexOf( "?" ) != -1 ) {
        var str = url.substr(1); //substr()方法返回从参数值开始到结束的字符串；
        var strs = str.split("&");
        for (var i = 0; i < strs.length; i++) {
            theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
        }
        console.log(theRequest);
        //此时的theRequest就是我们需要的参数；
    }

    function intype(data) {
        var inp1=document.getElementById("inspecttype");
        if(data.inspectState==1){
            inp1.value="质量检测";
        }else{
            inp1.value="安全检测";
        }
    }

    $(document).ready(function(){
        $.ajax({
            url :   "inspect/getinspect",
            type:   "post",
            data:JSON.stringify({
                inspectId : theRequest.inspectId,
            }),
            beforeSend: function(request) {
                request.setRequestHeader("token", "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxIiwiaWF0IjoxNTMyNDA4ODMzLCJzdWIiOiIxLHd6eSwwIiwiZXhwIjoxNTMyNDE2MDMzfQ.DEpHIrk2X8U4Un_SdDNiqqPPEYHXX6DYfx_prQ3QIZQ");
            },
            contentType:"application/json;",
            success:function(data){
                goToLogin(data);
                if(data==null||data==""||data==undefined){
                    $("#content").html("暂无数据");
                }else{
                    var content='<form id="payment">\n' +
            '    <fieldset>\n' +
            '        <legend>检测详情<a href="javascript:history.back()">返回</a></legend>\n' +
            '        <ol>\n' +
            '            <li>\n' +
            '                <label>项目名称：</label>\n' +
            '             <input  value='+data.data.projectName+' readonly="readonly" >\n' +
            '            </li>\n' +
            '            <li>\n' +
            '                <label>施工小队名称：</label>\n' +
            '                <input  value='+data.data.teamName+' readonly="readonly">\n' +
            '            </li>\n' +
            '            <li>\n' +
            '                <label>分部分项工程名称：</label>\n' +
            '                <input  value='+data.data.teamDesc+' readonly="readonly">\n' +
            '            </li>\n' +
            '            <li>\n' +
            '                <label>负责人名称：</label>\n' +
            '                <input  value='+data.data.personLiableName+' readonly="readonly">\n' +
            '            </li>\n' +
            '            <li>\n' +
            '                <label>负责人电话：</label>\n' +
            '                <input  value='+data.data.personLiablePhone+' readonly="readonly">\n' +
            '            </li>\n' +
            '            <li>\n' +
            '                <label>检测结果：</label>\n' +
            '                <input  value='+data.data.inspectStartResult+' readonly="readonly">\n' +
            '            </li>\n' +
            '            <li>\n' +
            '                <label>修复后结果：</label>\n' +
            '                <input  value='+data.data.inspectEndResult+' readonly="readonly" >\n' +
            '            </li>\n' +
            '            <li>\n' +
            '                <label>检测类型：</label>\n' +
            '                <input id="inspecttype" value="" readonly="readonly" >\n' +
            '            </li>\n' +
            '            <li>\n' +
            '                <label>附件：</label>\n' +
            '                <input  value='+data.data.fileUrl+' readonly="readonly" >\n' +
            '            </li>\n' +
            '            <li>\n' +
            '                <label>操作/申请人名称：</label>\n' +
            '                <input  value='+data.data.oprUserName+' readonly="readonly" >\n' +
            '            </li>\n' +
            '            <li>\n' +
            '                <label>操作/申请时间：</label>\n' +
            '                <input value="'+formatDateTime(data.data.oprDate)+'" readonly="readonly" >\n' +
            '            </li>\n' +
            '        </ol>\n' +
            '    </fieldset>\n' +
            '</form>';
                    $("#content").html(content);
                    intype(data.data);
                }
            }
        });
    });
</script>
</html>